﻿@model IEnumerable<LabManagement.Data.Lab>

@{
    ViewBag.Title = "Labs";
    ViewBag.PageHeader = "Labs";
}


<div class="box">
    <div class="box-title">
        @Html.ActionLink("Add New", "Create", null, new { @Class = "btn btn-primary pull-right" })
    </div>
    <div class="box-content nopadding">
        <table class="table table-hover table-nomargin table-bordered usertable">
            <thead>
                <tr class='thefilter'>
                    <th>
                        @Html.DisplayNameFor(model => model.LabName)
                    </th>
                    <th>
                        @Html.DisplayNameFor(model => model.LabDescription)
                    </th>
                    <th>
                        @Html.DisplayNameFor(model => model.LabShortDescription)
                    </th>
                    <th>
                        @Html.DisplayNameFor(model => model.ProductVersion)
                    </th>
                    <th>
                        @Html.DisplayNameFor(model => model.LabTimeLimitInMinutes)
                    </th>
                    <th>
                        @Html.DisplayNameFor(model => model.Active)
                    </th>
                    <th></th>
                </tr>
            </thead>
          
            <tbody>
                @{var i = 0; var delformId = string.Empty; }
                @foreach (var item in Model)
                {
                    i++;
                    delformId = "del_" + i;
                    <tr>
                        <td>
                            @Html.DisplayFor(modelItem => item.LabName)
                        </td>
                        <td>
                            @Html.DisplayFor(modelItem => item.LabDescription)
                        </td>
                        <td>
                            @Html.DisplayFor(modelItem => item.LabShortDescription)
                        </td>
                        <td>
                            @Html.DisplayFor(modelItem => item.ProductVersion)
                        </td>
                        <td>
                            @Html.DisplayFor(modelItem => item.LabTimeLimitInMinutes)
                        </td>
                        <td>
                            @Html.DisplayFor(modelItem => item.Active)
                        </td>
                        <td>

                            <a href="@Url.Action("edit", new {id = item.LabId })" class="btn" rel="tooltip" title="Edit">
                                <i class="fa fa-edit"></i>
                            </a>
                            <a href="#" data-id="@delformId" class="btn deleteaction" rel="tooltip" title="Delete">
                                <i class="fa fa-times"></i>
                            </a>
                            @using (Html.BeginForm("delete", "Labs", FormMethod.Post, new { id = delformId }))
                            {
                                @Html.AntiForgeryToken()
                                @Html.HiddenFor(modelitem=>item.LabId)
                            }
                    </tr>
                }
            </tbody>
           
            <tfoot>
                <tr>
                    <td colspan="6" class="text-right">
                        Pagination will come here
                    </td>
                </tr>
            </tfoot>
        </table>

    </div>
</div>
@section Scripts{
    <script type="text/javascript">
        $(".deleteaction").on("click", function () {
            if (confirm("Are you sure ? you wanted to delete this category")) {
                console.log("delCat_" + $(this).data("id"));
                $('#' + $(this).data("id")).submit();
            }
        });

    </script>
}



      
     